home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / faq / comp / fonts_fa / part6 < prev    next >
Text File  |  1994-01-25  |  23KB  |  418 lines

  1. Newsgroups: comp.fonts,comp.answers,news.answers
  2. Path: bloom-beacon.mit.edu!xlink.net!howland.reston.ans.net!usenet.ins.cwru.edu!eff!news.kei.com!world!ora.com!norm
  3. From: norm@ora.com (Norman Walsh)
  4. Subject: comp.fonts FAQ: OS/2 Info
  5. Message-ID: <font-faq-6_759515252@ora.com>
  6. Followup-To: poster
  7. Summary: This posting answers frequently asked questions about fonts.
  8.          It addresses both general font questions and questions that
  9.          are specific to a particular platform.
  10. Sender: norm@ora.com (Norman Walsh)
  11. Supersedes: <font-faq-6_757281740@ora.com>
  12. Reply-To: norm@ora.com (Norman Walsh)
  13. Organization: O'Reilly and Associates, Inc.
  14. References: <font-faq-1_759515252@ora.com>
  15. Date: Tue, 25 Jan 1994 16:28:03 GMT
  16. Approved: news-answers-request@MIT.Edu
  17. Expires: Thu, 10 Mar 1994 16:27:32 GMT
  18. Lines: 397
  19. Xref: bloom-beacon.mit.edu comp.fonts:6516 comp.answers:3562 news.answers:14502
  20.  
  21. Archive-name: fonts-faq/part6
  22. Version: 2.0.3
  23.  
  24. Subject: 4. OS/2 Information
  25.   
  26.   [ed: Except as otherwise noted, the entire OS/2 section of the
  27.   comp.fonts FAQ List is derived from the "Draft OS/2 Font FAQ" posted by
  28.   David J. Birnbaum.]
  29.   
  30.   This section if the FAQ is Copyright (C) 1993 by David J. Birnbaum.
  31.   All Rights Reserved.  Reproduced here by permission.
  32.   
  33.   [ed: Since this section of the FAQ is wholly derived from David's
  34.   document, some sections contain information repeated elsewhere in the
  35.   comp.fonts FAQ.]
  36.   
  37.   David Birnbaum's Introduction
  38.   =============================
  39.   
  40.   4 June 1993
  41.   
  42.   A couple of weeks ago I posted an inquiry to comp.fonts,
  43.   comp.os.os2.misc, and the OS2-L ListServ concerning some apparent
  44.   peculiarities in the way OS/2 handles font files. These "peculiarities"
  45.   actually reflect regular, systematic differences in OS/2, Windows, and
  46.   DOS font handling, which are not conveniently described in end-user
  47.   documentation. This posting is intended to spare others some of the
  48.   confusion I encountered as a result of this paradigm shift.
  49.   
  50.   This is the first (draft) distribution of this document and corrections
  51.   and suggestions are welcome. I am grateful to Henry Churchyard, Marc L.
  52.   Cohen, Bur Davis and Kamal Mansour for helpful discussions; they are
  53.   not, of course, responsible for any misinterpretation I may have
  54.   inflicted on their comments.
  55.   
  56. Subject: 4.1. Preliminaries
  57.   
  58.   Character: an informational unit consisting of a value (usually a byte)
  59.   and roughly corresponding to what we think of as letters, numbers,
  60.   punctuation, etc.
  61.   
  62.   Glyph: a presentational unit corresponding roughly to what we think of
  63.   as letters, numbers, punctuation, etc.
  64.   
  65.   Character vs glyph: Glyph and character are not necessarily the same;
  66.   the character <a> may be mapped to a Times Roman Lower Case <a> glyph
  67.   in one font and to a Helvetica Lower Case <a> glyph in another font.
  68.   Change of glyphs normally means a change in style of presentation,
  69.   while change in characters normally means a change in information.
  70.   There are gray areas and the definitions provided above are general,
  71.   approximate, and imprecise.
  72.   
  73.   Character set: an inventory of characters with certain assigned values.
  74.   ASCII is a 7-bit character set that specifies which "character cell"
  75.   (byte value) corresponds to which informational unit.
  76.   
  77.   Code Page: essentially synonymous with character set.
  78.   
  79.   Font: A collection of glyphs. A specific font may be isomorphic with a
  80.   specific character set, containing only glyphs corresponding to
  81.   characters in that set, with these glyphs mapped to the same byte
  82.   values as the characters they are intended to represent. PostScript
  83.   fonts often contain additional (unmapped) characters. Most importantly,
  84.   PostScript fonts may sometimes be remapped by an operating environment,
  85.   which is what leads to the disorienting cross-environment mismatch that
  86.   spurred my original posting.
  87.   
  88.   Fonts may be bitmapped or outline in format; a bitmapped format
  89.   corresponds to a particular size and weight for a particular device or
  90.   device resolution, while a single outline font is used to generate
  91.   multiple sizes as needed. Within an outline font system, different
  92.   weights (bold, semibold, italic, etc.) may be encoded as separate font
  93.   resources (separate outline files used to generate the glyphs) or may
  94.   all be generated from a single outline (slanting characters to make
  95.   "italics," fattening them for "bold," etc.).
  96.   
  97. Subject: 4.2. Fonts under DOS
  98.   
  99.   I used a large assortment of fonts under DOS for intricate multilingual
  100.   work. My setup at that time consisted of a library of bitmapped fonts
  101.   that could be sent to my HP LaserJet II printer, as well as a set of
  102.   fixed-size, fixed-width screen fonts that were supported by my Hercules
  103.   Graphics Card Plus (not the same as Hercules Graphics; the "Plus"
  104.   included an ability to store 3072 screen glyphs and display any of
  105.   these together, while standard character-mode displays were normally
  106.   limited to 256 or 512 such entities).
  107.   
  108.   Using XyWrite as a word processor, I would enter a "Mode" command to
  109.   change fonts and character sets simultaneously; this would make
  110.   different sets of screen glyphs available at the keyboard and would
  111.   insert a font-change command for my printer into the text stream. The
  112.   "Mode" and font-change commands were not displayed on the screen. The
  113.   result was not WYSIWYG, since I was limited to fixed-width screen
  114.   display and since I had far more printer glyphs available than the 3072
  115.   limit imposed by my video card; I used a brightness attribute to
  116.   indicate bold, I used the same screen font for different sizes of
  117.   printer fonts, etc. This worked and worked well, in that I could see
  118.   (for example) Russian, Greek, English, Polish, and other characters
  119.   simultaneously on the screen and I could print documents combining them.
  120.   
  121.   Architecturally, what was going on was that the character sets (code
  122.   pages) and fonts were entirely isomorphic and were hard- coded. If I
  123.   put a particular Russian letter into cell 246 of my screen and printer
  124.   fonts, that character was always there, and any strategy that would let
  125.   me access this cell (remapped keyboards, numeric keypad) was guaranteed
  126.   always to find the same character.
  127.   
  128. Subject: 4.3. Windows
  129.   
  130.   I recently began using PostScript fonts in Windows with AmiPro as my
  131.   word processor. These fonts came with printed cards indicating the
  132.   glyph mappings; I could look at the card and it would tell me that a
  133.   specific character lived in cell 246, and if I entered Alt-0246 at the
  134.   numeric keypad that glyph would appear on the screen. If I loaded the
  135.   font into Fontographer for Windows, these glyphs would be arrayed in
  136.   cells according to the map provided by Adobe with the fonts.
  137.   Fontographer also revealed that these fonts had other, "unmapped"
  138.   glyphs assigned to cells above 255.
  139.   
  140.   Given what appeared to be a hard correspondence among what I saw in
  141.   Fontographer, what was printed in Adobe's maps, and what was displayed
  142.   when I entered something at the keyboard, I naively assumed that
  143.   PostScript fonts were operating much like my bitmapped fonts under DOS.
  144.   There were some obvious differences, the primary one being that glyphs
  145.   of different sizes were all drawn from the same font resource files
  146.   under PostScript, but it appeared as if a glyph lived in a certain cell.
  147.   
  148. Subject: 4.4. Differences between Windows and OS/2
  149.   
  150.   This assumption was incorrect; PostScript fonts can be subdivided into
  151.   two types, one of which observes hard and invariant encodings similar
  152.   to those that apply to my bitmapped fonts, while the other represents a
  153.   completely different font mapping strategy. This difference became
  154.   apparent only when I attempted to share PostScript fonts between
  155.   Windows and OS/2 and got some unexpected results.
  156.   
  157.   A PostScript font under Windows involves two files, a PFB (PostScript
  158.   Font Binary) file, which contains the PostScript instructions needed to
  159.   draw each glyph and some mapping information, and a PFM (Printer Font
  160.   Metrics) file, which encodes width and kerning information. A
  161.   PostScript font under OS/2 also uses the same PFB file, but instead of
  162.   the PFM file it uses an AFM (Adobe Font Metrics) file. The AFM and PFM
  163.   files contain much of the same basic information (although the AFM file
  164.   is somewhat more complete); the most important differences are in
  165.   format (AFM is plain text, PFM is binary) and use (OS/2 uses AFM,
  166.   Windows uses PFM).
  167.   
  168. Subject: 4.5. Installation under Windows and Win-OS/2
  169.   
  170.   The OS/2 2.0 Font Palette tool (see below for changes to be introduced
  171.   with 2.1) by default installs fonts (both PFB and AFM files) into the
  172.   "\os2\dll" directory.  Win-OS/2 by default installs PFB files into
  173.   "\psfonts" and PFM files into "\psfonts\pfm".  These defaults can be
  174.   changed; since OS/2 and Win-OS/2 use the same PFB files, the user can
  175.   save disk space by allowing these to be shared (through installing into
  176.   the same directory, e.g., install OS/2 fonts into the "\psfonts"
  177.   directory instead of "\os2\dll".)  Note that fonts must be intalled and
  178.   removed through the Font Palette; if you copy, move, or delete a font
  179.   file without using the Font Palette, the system configuration files are
  180.   not updated and all hell breaks loose.
  181.   
  182.   Deleting fonts from Win-OS/2 causes the system to update the win.ini
  183.   file to remove references to the font, but does not delete any files
  184.   physically. Deleting fonts from the OS/2 Font Palette updates the
  185.   os2.ini configuration file and physically deletes the AFM and PFB files
  186.   from the disk.  This means that if you are sharing PFB files between
  187.   OS/2 and Win-OS/2, you can delete a Win-OS/2 font without hurting
  188.   native OS/2 operations, since the PFB reamins installed where OS/2
  189.   thinks it is. But if you delete an OS/2 font using the Font Palette,
  190.   the PFB file is erased from the disk even though the win.ini file is
  191.   not updated, so that Win-OS/2 thinks it is still there.
  192.   
  193. Subject: 4.6. FontSpecific PostScript Encoding
  194.   
  195.   Every PFB file contains an "encoding vector"; this is a plain text line
  196.   embedded near the head of the PFB file. Encoding vectors are of two
  197.   types: AdobeStandardEncoding and everything else. Adobe usually uses
  198.   the label "FontSpecific" for fonts that are not encoded according to
  199.   AdobeStandardEncoding, and I use it as a cover term here for any such
  200.   font.
  201.   
  202.   If you look at the readable plain text information at the head of a
  203.   FontSpecific type font, it includes a range of text that begins:
  204.   
  205.          /Encoding 256 array
  206.   
  207.   followed by a bunch of lines, each of which includes a number (which
  208.   corresponds to a cell in the font layout) and the name of the glyph
  209.   that lives in that cell. The unreadable binary data below this array
  210.   specification lists the name of each glyph and the PostScript
  211.   instructions for how the glyph is to be drawn.  There may be PostScript
  212.   code for drawing glyphs that are not included in the mapping array, but
  213.   only glyphs mentioned in the array specification are available to
  214.   applications.
  215.   
  216.   FontSpecific type fonts are comparable to the bitmapped fonts I used
  217.   under DOS. Each character physically is assigned to a specific cell
  218.   within the font file and operating environments are not allowed to
  219.   remap these. The glyph in cell 246 will be the same in both Windows and
  220.   OS/2.
  221.   
  222. Subject: 4.7. AdobeStandardEncoding
  223.   
  224.   AdobeStandardEncoding is a specific mapping of certain glyphs to
  225.   certain cells; in this respect it resembles FontSpecific encoding.
  226.   Because it is standardized, the array is not spelled out in the PFB
  227.   file; the line
  228.   
  229.          /Encoding StandardEncoding def
  230.   
  231.   tells Adobe Type Manager (ATM, either the Windows and Win-OS/2 version
  232.   or the native OS/2 version) that the encoding is "standard," and the
  233.   environments are expected to know what this standard is without having
  234.   the array spelled out in each font file.
  235.   
  236.   Although AdobeStandardEncoding is a real mapping, there is an
  237.   importance difference between it and various FontSpecific mappings:
  238.   operating environments are expected to remap AdobeStandardEncoding
  239.   fonts according to their own requirements.  That is, although
  240.   AdobeStandardEncoding does assign glyphs to cells, no operating
  241.   environment actually uses these assignments and any environment remaps
  242.   the glyphs before rendering them.  Confusion arises because Windows and
  243.   OS/2 remap such fonts in different ways.
  244.   
  245. Subject: 4.8. AdobeStandardEncoding under Windows (and Win-OS/2)
  246.   
  247.   An AdobeStandardEncoding font under Windows is remapped according to a
  248.   character map (code page) that MicroSoft calls Windows ANSI (can other
  249.   code pages be installed in Windows?). This determines which character
  250.   resides in which cell and the font is remapped so that glyphs and
  251.   characters will correspond. Since Fontographer for Windows is a Windows
  252.   application, it displays glyphs not in the cells in which they live
  253.   according to AdobeStandardEncoding, but in the cells to which they get
  254.   reassigned under the remapping to Windows ANSI. There is nothing
  255.   explicit in the PFB file that associates these characters with the
  256.   specific cells in which they appear under Windows.
  257.   
  258. Subject: 4.9. AdobeStandardEncoding under OS/2
  259.   
  260.   OS/2 operates within a set of supported code pages; two system- wide
  261.   code pages are specified in the config.sys file and an application is
  262.   allowed to switch the active code page to any supported code page (not
  263.   just these two). DeScribe, for example, currently operates in code page
  264.   (CP) 850, which includes most letters needed for western European Latin
  265.   alphabet writing. CP 850 does not contain typographic quotes, en- and
  266.   em-dashes, and other useful characters. It does contain the IBM
  267.   "pseudographics," which are useful for drawing boxes and lines with
  268.   monospaced fonts.
  269.   
  270.   When the user inputs a value (through the regular keyboard or the
  271.   numeric keypad), the application checks the active CP, looks up in an
  272.   internal table the name of the character that lives in that cell within
  273.   that CP, and translates it into a unique number that corresponds to one
  274.   of the 383 glyphs supported by OS/2 (the union of all supported code
  275.   pages). This number is passed to PM-ATM (the OS/2 ATM implementation),
  276.   which translate the glyph number into the glyph name that PostScript
  277.   fonts expect and searches the font for that name. The system never
  278.   looks at where a glyph is assigned under the AdobeStandardEncoding
  279.   array; rather, it scans the font looking for the character by name and
  280.   gives it an assignment derived from the active code page. This is the
  281.   remapping that OS/2 performs on AdobeStandardEncoding type fonts.
  282.   
  283.   As a result, a situation arises where, for example, <o+diaeresis> is
  284.   mapped to cell 246 under Windows ANSI but to cell 148 under CP 850.
  285.   Using the identical PFB file, this glyph is accessed differently in the
  286.   two operating environments.
  287.   
  288. Subject: 4.10. Consequences for OS/2 users
  289.   
  290.   If your font has a FontSpecific encoding, there are no unexpected
  291.   consequences; the same glyphs will show up at the same locations in
  292.   both Windows (Win-OS/2) and native OS/2. Regardless of what the active
  293.   code page is, if the font has a FontSpecific encoding OS/2 goes by cell
  294.   value; a specific glyph is hard-coded to a specific cell and OS/2 will
  295.   give you whatever it finds there, even if what it finds disagrees with
  296.   what the active code page would normally predict. In other words,
  297.   FontSpecific encoding means "ignore the mapping of the active code page
  298.   and rely on the mapping hard-coded into the font instead."
  299.   
  300.   If your font has an AdobeStandardEncoding encoding, the following
  301.   details obtain:
  302.   
  303.   1) The same PFB file may have glyphs that are accessible in one
  304.   environment but not another. For example, if DeScribe thinks it is
  305.   operating in CP 850, there is no access to typographic quotes, even if
  306.   those do occur in the PFB file and even if Windows can find them in the
  307.   same exact font file. DeScribe could switch code pages, but if the
  308.   application isn't set up to do so (and DeScribe currently isn't), those
  309.   characters are absolutely inaccessible to the user.
  310.   
  311.   2) If the active code page includes a character that isn't present in
  312.   the font, OS/2 has to improvise. For example, AdobeStandardEncoding
  313.   fonts do not normally include the IBM pseudographics, yet the user who
  314.   inputs the character value for one of these sends the system off to
  315.   look for it. As described above, OS/2 first checks the active font for
  316.   the glyph name that corresponds to that character and, if it finds it,
  317.   displays it.  If the glyph isn't found, OS/2 looks to the system Symbol
  318.   font.  This is not reported back to the user in DeScribe; if I have
  319.   Adobe Minion active (AdobeStandardEncoding, no information anywhere in
  320.   the font files for pseudographics) and input a pseudographic character,
  321.   DeScribe tells me it is still using Adobe Minion, even though it has
  322.   fetched the character it displays and prints from the Symbol font, a
  323.   different font resource file.
  324.   
  325. Subject: 4.11. Advice to the user
  326.   
  327.   OS/2's code page orientation provides some advantages, in that it
  328.   separates the character set (code page) mapping from the encoded font
  329.   mapping. The main inconvenience isn't a loss of function, but a
  330.   disorientation as users become accustomed to the new paradigm.
  331.   
  332.   If you need a glyph that you know is in your PFB file but that isn't in
  333.   the active code page (and if you can't change code pages within your
  334.   application), you can't get at it in OS/2 without tampering with the
  335.   font files. To tamper, you can use font manipulation tools to
  336.   redesignate the PFB file as FontSpecific ("Symbol" character set to
  337.   Fontographer). If you then map the glyphs you need into one of the
  338.   lower 256 cells (with some limitations), they will be accessible in all
  339.   environments. The Fontographer manual does not explain what the
  340.   "Symbol" character encoding label really does, it just tells you not to
  341.   use it except for real symbol fonts. In fact you should use it for any
  342.   font that will not correspond in inventory to the code page supported
  343.   by your application, which means any non-Latin fonts.
  344.   
  345.   You do not have to recode all your fonts, and you wouldn't normally
  346.   want to do so, since Fontographer hinting is not nearly as good as
  347.   Adobe's own hand-tuning and regenerating a font regenerates the hints.
  348.   All you have to do is make sure you have one FontSpecific type font
  349.   installed that includes your typographic quotes, etc. for each typeface
  350.   you need. Within DeScribe, you can then write a macro that will let you
  351.   switch fonts, fetch a character, and switch back, thereby allowing you
  352.   to augment any group of fonts with a single, shared set of typographic
  353.   quotes (or whatever) that you put in a single FontSpecific font.
  354.   Alternatively, OS/2 also supports CP 1004, which does contain
  355.   typographic quotes and other characters used for high-quality
  356.   typography, but the user may not be able to convince an application to
  357.   invoke this code page if it was not designed to do so.
  358.   
  359.   You can have any number of FontSpecific fonts installed, which means
  360.   that there is a mechanism for dealing with unsupported character sets
  361.   (code pages).
  362.   
  363.   You can also tinker with the font files to try to trick the operating
  364.   system. For example, using Fontographer or other utilities, you can
  365.   change the name assigned to a glyph description within the PFB file. If
  366.   you want to use AdobeStandardEncoding and you want to see a specific
  367.   glyph at a specific cell when DeScribe thinks it's using CP 850, you
  368.   have to make sure that the name assigned to the description of that
  369.   glyph is what DeScribe expects to find. OS/2 doesn't care whether, say,
  370.   <o+diaeresis> really looks like <o> with two dots over it, as long as
  371.   it bears the right name.
  372.   
  373.   This second approach is obviously far more complex and provides much
  374.   more opportunity for error. Its advantage is that OS/2 does not support
  375.   case conversion and sorting (other than in machine order) for
  376.   unsupported code pages, since these operations depend on character
  377.   names. Keeping supported names from supported code pages while changing
  378.   the artwork is one way to maintain order and case correspondences while
  379.   increasing the range of glyphs actually supported. I have not
  380.   experimented with this approach, since the use I would get out of the
  381.   adding functionality (over the FontSpecific encoding approach) is not
  382.   worth the amount of effort required.
  383.   
  384. Subject: 4.12. OS/2 2.1 and beyond
  385.   
  386.   OS/2 2.1 will change some aspects of font handling. First, OS/2 2.0
  387.   GA+SP has a bug that can cause OS/2 to crash when an AFM file with more
  388.   than 512 kern pairs is read. This is fixed in 2.1.  (This bug is
  389.   separate from a design limitation in MicroSoft Windows that causes
  390.   large kern tables to be read incorrectly.  This problem is still under
  391.   investigation; watch this space for a report.)
  392.   
  393.   Fonts in 2.1 will be installed by default into the "\psfonts" directory,
  394.   so that they will normally be shared with Win-OS/2 fonts. (The user will
  395.   still be able to specify a directory; all that will change is the
  396.   default). The user will also be able to instruct the Font Palette not to
  397.   delete font files when fonts are uninstalled, so as to avoid clobbering
  398.   a Win-OS/2 font by removing it from native OS/2 use through the Font
  399.   Palette (although the default will still be to delete the physical font
  400.   files).
  401.   
  402.   OS/2 will stop using AFM files and will replace these with OFM files, a
  403.   binary metrics file (different from PFM) that OS/2 will compile from
  404.   the AFM file during font installation. This will speed font loading,
  405.   since the system will not have to parse a plain text metrics file.
  406.   Additionally, the OS/2 PostScript printer driver used to install its
  407.   own, large font files, but will now use the OFM and PFB files, thereby
  408.   saving 50k-200k of disk space per installed font outline.
  409.   
  410.   IBM's long-term goal is to replace the 383-entity inventory of
  411.   supported glyphs with Unicode. This is very much a long-term goal and
  412.   there is not even a hint of when it might become available.  It has its
  413.   own problems, stemming from the fact that Unicode is essentially a
  414.   character standard and glyph and character inventories may differ is
  415.   assorted ways, but it will be a significant step in the proverbial
  416.   right direction.
  417.   
  418.